package jpa.generate.value.entity;

import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import jpa.generate.value.CurrentTimeGenerator;
import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.GenerationTime;
import org.hibernate.annotations.GeneratorType;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.UpdateTimestamp;

@Data
@Entity
public class ValueGenerationTypeEntity {
  @GenericGenerator(name = "CommonGenerateValue", strategy = "uuid2")
  @GeneratedValue(generator = "CommonGenerateValue")
  @Id
  private String id;

  @GeneratorType(when = GenerationTime.INSERT, type = CurrentTimeGenerator.class)
  private Long createdAt1;

  @CreationTimestamp
  private Date createdAt2;

  @UpdateTimestamp
  private Date updatedAt;
}
